#include"tcp_server.hpp"
#include"err.hpp"
#include<iostream>
#include<memory>
using namespace std;
using namespace ns_server;

#include<cstring>

void Usage(string pro)
{
    cout<<"Useage\n\t"<<pro<<" prot\n"<<endl;
}

string echoserver(const string& str)
{
    return str;
}

//./server port
int main(int argc, char* argv[])
{
    if(argc!=2)
    {
        Usage(argv[0]);
        exit(USE_ERR);
    }
    uint16_t port=atoi(argv[1]);

    unique_ptr<TcpServer> ts(new TcpServer(echoserver,port));

    ts->Init();
    ts->Start();

    return 0;
}